import type { FormSchemaGetter } from '#/adapter/form';
import type { VxeGridProps } from '#/adapter/vxe-table';


export const querySchema: FormSchemaGetter = () => [
  {
    component: 'Input',
    fieldName: 'tradeName',
    label: '药品名称',
  },
  {
    component: 'Input',
    fieldName: 'manufacturer',
    label: '生产厂家',
  },
];

// 需要使用i18n注意这里要改成getter形式 否则切换语言不会刷新
// export const columns: () => VxeGridProps['columns'] = () => [
export const columns: VxeGridProps['columns'] = [
  { type: 'checkbox', width: 60 },
  // {
  //   title: '药品通用名',
  //   field: 'genericName',
  // },
  {
    title: '药品名称',
    field: 'tradeName',
  },
  {
    title: '规格',
    field: 'specification',
  },
  {
    title: '生产厂家',
    field: 'manufacturer',
  },
  {
    title: '备注',
    field: 'remark',
  },
  {
    field: 'action',
    fixed: 'right',
    slots: { default: 'action' },
    title: '操作',
    width: 180,
  },
];

export const modalSchema: FormSchemaGetter = () => [
  {
    label: '药品ID',
    fieldName: 'id',
    component: 'Input',
    dependencies: {
      show: () => false,
      triggerFields: [''],
    },
  },
  {
    label: '药品名称',
    fieldName: 'tradeName',
    component: 'Input',
    rules: 'required',
  },
  {
    label: '药品规格',
    fieldName: 'specification',
    component: 'Input',
    rules: 'required',
  },
  {
    label: '生产厂家',
    fieldName: 'manufacturer',
    component: 'Input',
    rules: 'required',
  },
  {
    label: '备注',
    fieldName: 'remark',
    component: 'Input',
  },
];
